import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';

main(){
  runApp(HomePage_Wallet());
}


class Myheader extends ClassicalHeader {
  final String refreshText='下拉刷新';
  final String refreshReadyText='下拉刷新';
  final String refreshingText='正在刷新...';
  final Color infoColor=Colors.grey;
  final String infoText='获得最新发布订单';
  final String refreshedText='获取成功';
  final Color textColor=Color.fromRGBO(22,155,213,1);
}

//--------------------------余额提现跳转页-----------------------------

class Withdrawal extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return MaterialApp(
      home: Scaffold(
        appBar:new AppBar(
          backgroundColor: Color.fromRGBO(51, 51, 51, 1),
          titleSpacing: 0.0,
          title:Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              FlatButton(
                materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
                child: Row(
                  children: [
                    Icon(Icons.arrow_back_ios,color: Colors.white,),
                    Text('返回',style: TextStyle(color: Colors.white,fontSize: 16),)
                  ],
                ),
                onPressed: (){
                  Navigator.pop(context);
                },
              ),
              Container(child: Row(children: [
                Text('提现',style: TextStyle(fontSize: 16,color: Colors.white),),
                SizedBox(width: 25,)
              ],),),
              IconButton(icon: Icon(Icons.more_horiz,color: Colors.white,), onPressed: (){})
            ],
          ),
        ),
        body: Container(),
      ),
    );
  }
}

//-------------------------------------------------------------------------

class HomePage_Wallet extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return MaterialApp(
      home: HomePage_Wallet_Stateful(),
    );
  }
}

class HomePage_Wallet_Stateful extends StatefulWidget{
  @override
  HomePage_Wallet_State createState() => new HomePage_Wallet_State();
}

class HomePage_Wallet_State extends State{
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return MaterialApp(
      theme: ThemeData(
        primarySwatch: Colors.grey,
      ),
      home: Scaffold(
        appBar: AppBar(
          backgroundColor: Color.fromRGBO(51, 51, 51, 1),
          titleSpacing: 0.0,
          title:Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              FlatButton(
                materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
                child: Row(
                  children: [
                    Icon(Icons.arrow_back_ios,color: Colors.white,),
                    Text('返回',style: TextStyle(color: Colors.white,fontSize: 16),)
                  ],
                ),
                onPressed: (){
                  Navigator.pop(context);
                },
              ),
              Container(child: Row(children: [
                Text('我的钱包',style: TextStyle(fontSize: 16,color: Colors.white),),
                SizedBox(width: 25,)
              ],),),
              IconButton(icon: Icon(Icons.more_horiz,color: Colors.white,), onPressed: (){})
            ],
          ),
        ),
        body: Container(
          color: Colors.grey.withOpacity(0.3),
          child: Column(
            children: [
              Container(
                padding: EdgeInsets.only(top: 10,bottom: 10,left: 20,right: 20),
                color: Colors.white,
                height: 125,
                child: Row(
                  children: [
                    Container(
                      alignment: Alignment.topLeft,
                      child: Text('剩余余额',style: TextStyle(fontSize: 13),),
                    ),
                    Container(
                      margin: EdgeInsets.only(left: 30),
                      alignment: Alignment.center,
                      child: Text('￥60.00',style: TextStyle(fontSize: 40,fontWeight: FontWeight.w600),),
                    ),
                  ],
                ),
              ),
              Container(
                child: Text('下拉刷新',style: TextStyle(color: Color.fromRGBO(22,155,213,1)),),
              ),
              Expanded(
                child: EasyRefresh(
                  header: Myheader(),
                  onRefresh: ()async{},
                  child: Container(
                    color: Colors.white,
                    padding: EdgeInsets.only(left: 20,right: 20),
                    child: Container(
                      alignment: Alignment.topLeft,
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Container(
                            padding: EdgeInsets.only(top: 15,bottom: 15),
                            child: Text('收入明细',style: TextStyle(fontSize: 18),),
                          ),
                          Container(
                            margin: EdgeInsets.only(bottom: 10),
                            child: Row(
                              mainAxisAlignment: MainAxisAlignment.spaceBetween,
                              children: [
                                Column(
                                  crossAxisAlignment: CrossAxisAlignment.start,
                                  children: [
                                    Text('接单获得',style: TextStyle(fontSize: 14),),
                                    Text('2017-06-18  08:41:11',style: TextStyle(color: Colors.grey,fontSize: 13),),
                                  ],
                                ),
                                Container(
                                  child: Text('+4.00',style: TextStyle(color: Colors.red,fontSize: 15),),
                                )
                              ],
                            ),
                          ),
                          Container(
                            margin: EdgeInsets.only(bottom: 10),
                            child: Row(
                              mainAxisAlignment: MainAxisAlignment.spaceBetween,
                              children: [
                                Column(
                                  crossAxisAlignment: CrossAxisAlignment.start,
                                  children: [
                                    Text('提现',style: TextStyle(fontSize: 14),),
                                    Text('2017-06-18  08:41:11',style: TextStyle(color: Colors.grey,fontSize: 13),),
                                  ],
                                ),
                                Container(
                                  child: Text('-10.00',style: TextStyle(color: Colors.green,fontSize: 15),),
                                )
                              ],
                            ),
                          ),
                          Container(
                            margin: EdgeInsets.only(bottom: 10),
                            child: Row(
                              mainAxisAlignment: MainAxisAlignment.spaceBetween,
                              children: [
                                Column(
                                  crossAxisAlignment: CrossAxisAlignment.start,
                                  children: [
                                    Text('分润获得',style: TextStyle(fontSize: 14),),
                                    Text('2017-06-18  08:41:11',style: TextStyle(color: Colors.grey,fontSize: 13),),
                                  ],
                                ),
                                Container(
                                  child: Text('+1.00',style: TextStyle(color: Colors.red,fontSize: 15),),
                                )
                              ],
                            ),
                          ),
                          Container(
                            margin: EdgeInsets.only(bottom: 10),
                            child: Row(
                              mainAxisAlignment: MainAxisAlignment.spaceBetween,
                              children: [
                                Column(
                                  crossAxisAlignment: CrossAxisAlignment.start,
                                  children: [
                                    Text('打赏获得',style: TextStyle(fontSize: 14),),
                                    Text('2017-06-18  08:41:11',style: TextStyle(color: Colors.grey,fontSize: 13),),
                                  ],
                                ),
                                Container(
                                  child: Text('+4.00',style: TextStyle(color: Colors.red,fontSize: 15),),
                                )
                              ],
                            ),
                          ),
                        ],
                      ),
                    )
                  ),
                ),
              ),
              GestureDetector(
                child: Container(
                    alignment: Alignment.bottomCenter,
                    padding: EdgeInsets.only(top: 10,bottom: 10),
                    color: Colors.grey,
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: [
                        Text('余额提现',style: TextStyle(color: Colors.white,fontSize: 13),),
                      ],
                    )
                ),
                onTap: (){
                  Navigator.of(context).push(new MaterialPageRoute(builder: (BuildContext context){
                    return Withdrawal();
                  }));
                },
              )
            ],
          )
        ),
      ),
    );
  }
}